package com.hongkzh.www.game.controller;

import com.hongkzh.www.conmon.BaseController;
import com.hongkzh.www.conmon.BusinessException;
import com.hongkzh.www.conmon.ReqResponse;
import com.hongkzh.www.game.service.GameService;
import com.hongkzh.www.mediaShop.service.MediaShopService;
import com.hongkzh.www.shop.service.OrderService;
import com.hongkzh.www.shop.service.ProductService;
import com.hongkzh.www.swagger.annotation.*;
import com.hongkzh.www.user.service.UserService;
import com.jfinal.kit.StrKit;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;

import java.util.List;

/**
 * @author martins
 */
@Api(tag = "game", description = "游戏接口")
public class GameController extends BaseController {
     GameService gameService=new GameService();
    ProductService productService=new ProductService();
    static UserService userService = new UserService();
    MediaShopService mediaShopService=new MediaShopService();
    @ApiOperation(url = "/v1/game/systemNotice", tag = "game", httpMethod = "post",description = "系统公告")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = " 第一条数据为本月数据  title 标题 imgSrc图片 id  banner 详情头部图片 remarks 说明"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })
    public void systemNotice(){
        String loginUid=getAttr("loginUid");
        int pageNumber=getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r=new ReqResponse();
        Page record= gameService.systemNotice(loginUid,pageNumber);
        r.setData(record);
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/personProductList", tag = "game", httpMethod = "post",description = "游戏商品列表")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string"),
            @Param(name = "title", description = "内容", required = false, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "   price价格 title 标题 imgSrc图片 productId 产品id "),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })
    public void personProductList(){
        String loginUid=getAttr("loginUid");
        String title=getAttr("title");
        int pageNumber=getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r=new ReqResponse();
        Page record= gameService.personProductList(loginUid,pageNumber,title);
        r.setData(record);
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/getMediaProductById", tag = "game", httpMethod = "post",description = "游戏商品详情")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "provinceId", description = "省份id", required = false, dataType = "string"),
            @Param(name = "productId", description = "产品id", required = true, dataType = "string")

    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{ productId 产品id  title 标题 subtitle 副标题 integral 价格   descript 详情" +
                            "    images [imgSrc] 主轮播图 freightId 运费id freight 运费 mediaUserId 自媒体商家id" +
                            "user商家信息[ headImg 头像 name 名称  ]" +
                            " skus [model 规格  sukId sku的id num 库存 price 价格 ]  }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })
    public void getMediaProductById(){
        String loginUid=getAttr("loginUid");
        String productId=getPara("productId");
        String provinceId=getPara("provinceId");
        ReqResponse<Record> r=new ReqResponse();
        Record record=productService.getMediaProductById(productId,provinceId);
        r.setData(record);
        renderJson(r);
    }



    @ApiOperation(url = "/v1/game/addCart", tag = "game", httpMethod = "post",description = "游戏-加入购物车")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "mediaUserId", description = "自媒体用户", required = false, dataType = "string"),
            @Param(name = "productId", description = "产品id", required = true, dataType = "string"),
            @Param(name = "skuId", description = "skuid", required = true, dataType = "string"),
            @Param(name = "number", description = "数量", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = " 购物车数量 "),
                    @ResponseHeader(name="msg",description = "失败原因") })
    })
    public void addCart() {
        String loginUid=getAttr("loginUid");
        String productId=getPara("productId");
        String skuId=getPara("skuId");
        String number=getPara("number");
        String mediaUserId=getPara("mediaUserId");

        ReqResponse<Record> r=new ReqResponse();
        r.setData(enhance(MediaShopService.class).addCart(loginUid,"",productId,skuId,number,mediaUserId,"2","1"));
        renderJson(r);
    }
    @ApiOperation(url = "/v1/mediaShop/cartCount", tag = "mediaShop", httpMethod = "post",description = "游戏-购物车数量")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "  购物车数量"),
                    @ResponseHeader(name="msg",description = "失败原因") })
    })
    public void cartCount() {
        String loginUid=getAttr("loginUid");
        ReqResponse<Integer> r=new ReqResponse();
        r.setData(mediaShopService.cartCount(loginUid,"2"));
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/updateCart", tag = "game", httpMethod = "post",description = "游戏-修改购物车数量")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "cartId", description = "购物车id", required = true, dataType = "string"),
            @Param(name = "number", description = "数量", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = ""),
                    @ResponseHeader(name="msg",description = "失败原因") })
    })
    public void updateCart() {
        String loginUid=getAttr("loginUid");
        String cartId=getPara("cartId");
        String number=getPara("number");
        ReqResponse  r=new ReqResponse();
        enhance(MediaShopService.class).updateCart(loginUid,cartId,number);
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/deleteCartByid", tag = "game", httpMethod = "post",description = "游戏-删除购物车")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "cartId", description = "购物车id逗号隔开 ", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = " 购物车数量 "),
                    @ResponseHeader(name="msg",description = "失败原因") })
    })
    public void deleteCartByid() {
        String loginUid=getAttr("loginUid");
        String cartId=getPara("cartId");
        ReqResponse<Integer> r=new ReqResponse();
        r.setData(enhance(MediaShopService.class).deleteCartByid(loginUid,cartId,"2"));
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/cartList", tag = "game", httpMethod = "post",description = "游戏-购物车列表")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description =
                            " colorName 颜色 productId 商品id currentTime  当前时间" +
                            " title 标题 limitTime 限制时间 number 购物车数量 productNumber 库存   specName 规格名称" +
                            "integral乐币 mediaUserId 自媒体用户id cartId 购物车id  imgSrc 商品图片 skuId  "),
                    @ResponseHeader(name="msg",description = "失败原因") })
    })
    public void cartList() {
        String loginUid=getAttr("loginUid");
        List<Record> list= mediaShopService.cartList(loginUid,"2");
        ReqResponse<List<Record>> r=new ReqResponse();
        r.setData(list);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/game/couponList", tag = "game", httpMethod = "post",description = "游戏-折扣券列表")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "isPay", description = "0不用1花钱", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "  couponId 折扣券id  title 名称  imgSrc 图 integral 价格 discount 折扣 beginTime开始时间 endTime结束时间 "),
                    @ResponseHeader(name="msg",description = "失败原因") })
    })
    public void couponList() {
        int isPay=getParaToInt("isPay");
        String loginUid=getAttr("loginUid");
        List<Record> list= gameService.couponList(loginUid,isPay);
        ReqResponse<List<Record>> r=new ReqResponse();
        r.setData(list);
        renderJson(r);
    }

    @ApiOperation(url = "/v1/game/getCouponByCouponId", tag = "game", httpMethod = "post",description = "游戏-折扣券详情")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "couponId", description = "折扣券id", required = true, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{   " +
                            " couponId 优惠券id  title 名称  imgSrc 图 integral 乐币 discount  折扣 beginTime 开始时间 endTime 结束时间 remarks说明 " +
                            "userName用户名 headImg 头像 imgs 轮播图[imgSrc] "),
                    @ResponseHeader(name="msg",description = "失败原因") })
    })
    public void getCouponByCouponId(){
        String couponId=getPara("couponId");
        ReqResponse<Record> r=new ReqResponse();
        Record record=gameService.getCouponByCouponId(couponId);
        r.setData(record);
        renderJson(r);
    }


    @ApiOperation(url = "/v1/game/myBox", tag = "game", httpMethod = "post",description = "游戏-储物箱-我的所有")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页数", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{  coupons优惠券 [couponId 优惠券id beginTime开始时间 endTime 结束时间 productId 产品id state  1正常   title 名称  discount 折扣 imgSrc 图 integral 乐币   pintegral 产品价格]" +
                            "products 商品 [productId产品id createDate 创建时间 title 标题 imgSrc 主图   price 价格 num数量]  }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void myBox(){
        String loginUid=getAttr("loginUid");
        int pageNumber=getParaToInt("pageNumber");

        ReqResponse< Record> r=new ReqResponse();
        try {
            r.setData(userService.myBox(loginUid,pageNumber));
        }catch (Exception e){
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/game/myShelves", tag = "game", httpMethod = "post",description = "游戏-我的货架")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页数", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{ state 0没有1商品2优惠券 shelvesId 货架id rank 序号 createDate 创建时间 endDate 结束时间 currentTime 当前时间" +
                            " coupon 优惠券 [couponId 优惠券id beginTime开始时间 endTime 结束时间 productId 产品id state  1正常   title 名称  discount 折扣 imgSrc 图 integral 乐币   pintegral 产品价格]" +
                            "product 商品 [productId产品id createDate 创建时间 title 标题 imgSrc 主图 isnew 1是二手物0不是   price 价格 num数量]  }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void myShelves(){
        String loginUid=getAttr("loginUid");
        int pageNumber=getParaToInt("pageNumber");

        ReqResponse< Page<Record>> r=new ReqResponse();
        try {
            r.setData(userService.myShelves(loginUid,pageNumber));
        }catch (Exception e){
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/game/getShopShelves", tag = "game", httpMethod = "post",description = "游戏-店铺-商品")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "snumber", description = "店铺号", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页数", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{ state 0没有1商品2优惠券 shelvesId 货架id rank 序号 createDate 创建时间 endDate 结束时间 currentTime 当前时间" +
                            " coupon 优惠券 [couponId 优惠券id beginTime开始时间 endTime 结束时间 productId 产品id state  1正常   title 名称  discount 折扣 imgSrc 图 integral 乐币   pintegral 产品价格]" +
                            "product 商品 [productId产品id createDate 创建时间 title 标题 imgSrc 主图 isnew 1是二手物0不是   price 价格 num数量]  }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void getShopShelves(){
        String loginUid=getAttr("loginUid");
        int pageNumber=getParaToInt("pageNumber");
        String snumber=getPara("snumber");
        ReqResponse< Page<Record>> r=new ReqResponse();
        try {
            r.setData(userService.getShopShelves(loginUid,pageNumber,snumber));
        }catch (Exception e){
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/game/productShelves", tag = "game", httpMethod = "post",description = "游戏 -我的货架-上架商品")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "productId", description = "产品id ", required = true, dataType = "string"),
            @Param(name = "rank", description = "序号", required = true, dataType = "string"),
            @Param(name = "state", description = "1上架 2下架 ", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{   }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void productShelves(){
        String loginUid=getAttr("loginUid");
        String productId=getPara ("productId");
        String state=getPara("state");
        int rank=getParaToInt("rank");
        ReqResponse< Record> r=new ReqResponse();
   try {
       enhance(UserService.class).productShelves(loginUid, productId, state, rank);
   }catch (BusinessException e){
       r.setCode(1);
       r.setMsg(e.getErrMsg());
   }
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/couponShelves", tag = "game", httpMethod = "post",description = "游戏 -我的货架-上架折扣券")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "couponId", description = "优惠券id ", required = true, dataType = "string"),
            @Param(name = "rank", description = "序号", required = true, dataType = "string"),
            @Param(name = "integral", description = "乐币 ", required = true, dataType = "string"),
            @Param(name = "state", description = "1上架 2下架 ", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{   }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void couponShelves(){
        String loginUid=getAttr("loginUid");
        String couponId=getPara ("couponId");
        String integral=getPara ("integral");
        String state=getPara("state");
        int rank=getParaToInt("rank");

        ReqResponse< Record> r=new ReqResponse();
        enhance(UserService.class).couponShelves(loginUid,couponId,integral,state,rank);
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/myNormalCoupon", tag = "game", httpMethod = "post",description = "游戏-储物箱-我的优惠券")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页数", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{  couponId 优惠券id beginTime开始时间 endTime 结束时间 productId 产品id state  1正常   title 名称  discount 折扣 imgSrc 图 integral 乐币   pintegral 产品价格}"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void myNormalCoupon(){
        String loginUid=getAttr("loginUid");
        int pageNumber=getParaToInt("pageNumber");
        String state=getPara("state");
        ReqResponse<Page<Record>> r=new ReqResponse();
        try {
            r.setData(userService.myNormalCoupon(loginUid,pageNumber));
        }catch (Exception e){
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }

    /**
     * 我的商品
     */
    @ApiOperation(url = "/v1/game/myProduct", tag = "game", httpMethod = "post",description = "游戏-储物箱-我的商品列表")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "pageNumber", description = "页码", required = true, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "productId产品id createDate 创建时间 title 标题 imgSrc 主图   price 价格 num数量 isupper 1上架0下架 "),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })
    public void myProduct(){
        String loginUid=getAttr("loginUid");
        int pageNumber=getParaToInt("pageNumber");
        ReqResponse<Page<Record>> r=new ReqResponse();
        Page<Record> record= userService.myProduct(loginUid,pageNumber);

        r.setData(record);
        renderJson(r);
    }
    /**
     * 购买货架
     */
    @ApiOperation(url = "/v1/game/buyShelves", tag = "game", httpMethod = "post",description = "游戏-储物箱-购买货架")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "rank", description = "序号", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = " "),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })
    public void buyShelves(){
        String loginUid=getAttr("loginUid");
        int rank=getParaToInt("rank");
        ReqResponse<Page<Record>> r=new ReqResponse();
        userService.buyShelves(loginUid,rank);


        renderJson(r);
    }


    @ApiOperation(url = "/v1/game/getAllshop", tag = "game", httpMethod = "post",description = "游戏-所有店铺")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{ snumber 店铺编号rent 租金 title 名称 userId 用户id type 1一般2高级 cname 分类名称 coverImgSrc 气泡图片 }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void getAllshop(){
        String loginUid=getAttr("loginUid");
        ReqResponse<List<Record>> r=new ReqResponse();
        try {
            r.setData(gameService.getAllshop());
        }catch (Exception e){
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/game/rentShop", tag = "game", httpMethod = "post",description = "游戏-店铺-租店铺")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "snumber", description = "店铺编号", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{ }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void rentShop(){
        String loginUid=getAttr("loginUid");
        int snumber=getParaToInt("snumber");
        ReqResponse<Record> r=new ReqResponse();
        try {
            r.setData(gameService.rentShop(loginUid,snumber));
        }catch (Exception e){
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }
    /*@ApiOperation(url = "/v1/game/payRentShop", tag = "game", httpMethod = "post",description = "游戏-店铺-支付租金")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "orderNumber", description = "店铺订单号", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{ }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void payRentShop(){
        String loginUid=getAttr("loginUid");
        String orderNumber=getPara("orderNumber");
        ReqResponse<Record> r=new ReqResponse();
        try {
             gameService.payRentShop(loginUid,orderNumber);
        }catch (Exception e){
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }*/
    @ApiOperation(url = "/v1/game/getShopBySnumber", tag = "game", httpMethod = "post",description = "游戏-店铺-详情")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "snumber", description = "店铺号", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{ isMy 1是自己的店铺 0 不是  title 店铺标题 type 1一般2高级 name 用户名称 headImg 头像 cname 分类名称imgSrc 分类图片 }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void getShopBySnumber(){
        String loginUid=getAttr("loginUid");
        String snumber=getPara("snumber");
        ReqResponse<Record> r=new ReqResponse();
        try {
            r.setData(gameService.getShopBySnumber(loginUid,snumber));
        }catch (Exception e){
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/updateShopTitle", tag = "game", httpMethod = "post",description = "游戏-店铺-修改店铺名称")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "snumber", description = "店铺号", required = true, dataType = "string"),
            @Param(name = "title", description = "店铺号", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{   }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void updateShopTitle(){
        String loginUid=getAttr("loginUid");
        String snumber=getPara("snumber");
        String title=getPara("title");
        ReqResponse<Record> r=new ReqResponse();
        try {
             gameService.updateShopTitle(loginUid,snumber,title);
        }catch (Exception e){
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/updateShopCategory", tag = "game", httpMethod = "post",description = "游戏-店铺-修改店铺分类")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "snumber", description = "店铺号", required = true, dataType = "string"),
            @Param(name = "categoryId", description ="分类", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{   }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void updateShopCategory(){
        String loginUid=getAttr("loginUid");
        String snumber=getPara("snumber");
        String categoryId=getPara("categoryId");
        ReqResponse<Record> r=new ReqResponse();
        try {
            gameService.updateShopCategory(loginUid,snumber,categoryId);
        }catch (Exception e){
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/getShopCategoryList", tag = "game", httpMethod = "post",description = "游戏-店铺-分类列表")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{ categoryId 分类id  name 名称 imgSrc 图片  remarks 说明}"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void getShopCategoryList(){
        String loginUid=getAttr("loginUid");

        ReqResponse<List<Record>> r=new ReqResponse();
        try {
           r.setData(gameService.getShopCategoryList(loginUid));
        }catch (Exception e){
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/getMyShop", tag = "game", httpMethod = "post",description = "游戏-店铺-我的店铺")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{ isMy 1是自己的店铺 0 不是  title 店铺标题 type 1一般2高级 name 用户名称 headImg 头像 cname 分类名称imgSrc 分类图片  }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void getMyShop(){
        String loginUid=getAttr("loginUid");
        ReqResponse< Record > r=new ReqResponse();
        try {
            r.setData(gameService.getMyShop(loginUid));
        }catch (Exception e){
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }


    @ApiOperation(url = "/v1/game/myData", tag = "game", httpMethod = "post",description = "游戏-我的数据")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{ integral乐币 bean 乐豆 lobo 乐宝 }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void myData(){
        String loginUid=getAttr("loginUid");
        ReqResponse< Record> r=new ReqResponse();
        try {
            r.setData(gameService.myData(loginUid));
        }catch (Exception e){
            e.printStackTrace();
            r.setCode(1);
        }
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/mySynthesis", tag = "game", httpMethod = "post",description = "游戏-合成大厅-合成中")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{ synthesisId 合成id integral 加速乐币 beginTime 开始时间 currentTime 当前时间 endTime 结束时间 }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void mySynthesis(){
        String loginUid=getAttr("loginUid");
        ReqResponse< Record> r=new ReqResponse();
        try {
            r.setData(gameService.mySynthesis(loginUid));
        }catch (Exception e){
            e.printStackTrace();
            r.setCode(1);
        }
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/synthesisLobo", tag = "game", httpMethod = "post",description = "游戏-合成大厅-合成")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{ synthesisId 合成id integral 加速乐币 beginTime 开始时间 currentTime 当前时间 endTime 结束时间 }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void synthesisLobo(){
        String loginUid=getAttr("loginUid");
        ReqResponse< Record> r=new ReqResponse();
        try {
            r.setData(enhance(GameService.class).synthesisLobo(loginUid));
        }catch (Exception e){
           r.setMsg(e.getMessage());
            r.setCode(1);
        }
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/synthesisLoboSuccess", tag = "game", httpMethod = "post",description = "游戏-合成大厅-合成成功")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "synthesisId", description = "合成id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{  }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void synthesisLoboSuccess(){
        String loginUid=getAttr("loginUid");
        String synthesisId=getPara("synthesisId");

        ReqResponse< Record> r=new ReqResponse();
        if(StrKit.isBlank(synthesisId)){
            r.setMsg("参数错误");
            r.setCode(1);
        }
        else {
            try {
                enhance(GameService.class).synthesisLoboSuccess(loginUid, synthesisId);
            } catch (BusinessException e) {
                r.setMsg(e.getErrMsg());
                r.setCode(1);
            }
        }
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/accelerateSynthesisLobo", tag = "game", httpMethod = "post",description = "游戏-合成大厅-加速合成")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "synthesisId", description = "合成id", required = true, dataType = "string"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{  synthesisId 合成id integral 加速乐币 beginTime 开始时间 currentTime 当前时间 endTime 结束时间}"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void accelerateSynthesisLobo(){
        String loginUid=getAttr("loginUid");
        String synthesisId=getPara("synthesisId");

        ReqResponse< Record> r=new ReqResponse();
        if(StrKit.isBlank(synthesisId)){
            r.setMsg("参数错误");
            r.setCode(1);
        }
        else {
            try {
                r.setData(enhance(GameService.class).accelerateSynthesisLobo(loginUid, synthesisId));
            } catch (BusinessException e) {
                r.setMsg(e.getErrMsg());
                r.setCode(1);
            }
        }
        renderJson(r);
    }

    @ApiOperation(url = "/v1/game/gameRechargeOrder", tag = "game", httpMethod = "post",description = "游戏-充值")
    @Params({
            @Param(name = "loginUid", description = "当前登录用户id", required = true, dataType = "string"),
            @Param(name = "integral", description = "充值的乐币数", required = true, dataType = "string"),

    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = "{orderNumber 订单号 ，money 人民币金额  }"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })

    public void gameRechargeOrder(){
        String loginUid=getAttr("loginUid");
        int integral=getParaToInt("integral");
        ReqResponse<Record> r=new ReqResponse();
        try {
           r.setData(gameService.gameRechargeOrder(loginUid,integral));
        }catch (Exception e){
            e.printStackTrace();
            r.setCode(1);

        }
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/buyCoupon", tag = "game", httpMethod = "post",description = "游戏-购买优惠券")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "couponId", description = "优惠券id", required = true, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = " "),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })
    public void buyCoupon(){
        String loginUid=getAttr("loginUid");
        String couponId=getPara("couponId");
        ReqResponse<Record> r=new ReqResponse();
        try {
            enhance(OrderService.class).buyCoupon(couponId, loginUid);
        }catch (BusinessException e){
            r.setCode(1);
            r.setMsg(e.getMessage());
        }
        renderJson(r);
    }
    @ApiOperation(url = "/v1/game/advList", tag = "game", httpMethod = "post",description = "游戏-广告列表")

    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = " imgSrc 图片  number 序号"),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })
    public void advList(){

        ReqResponse<List<Record>> r=new ReqResponse();
        try {
           r.setData(gameService.advList());
        }catch (BusinessException e){
            r.setCode(1);
            r.setMsg(e.getMessage());
        }
        renderJson(r);
    }
    /*@ApiOperation(url = "/v1/game/buyCoupon", tag = "game", httpMethod = "post",description = "游戏-购买商品")
    @Params({
            @Param(name = "loginUid", description = "当前用户id", required = true, dataType = "string"),
            @Param(name = "couponId", description = "优惠券id", required = true, dataType = "string")
    })
    @ApiResponses({
            @ApiResponse(code=200,message="成功",responseHeaders={
                    @ResponseHeader(name="code",description = " 0成功 1失败"),
                    @ResponseHeader(name="data",description = " "),
                    @ResponseHeader(name="msg",description = "失败原因") })

    })
    public void buyCoupon(){
        String loginUid=getAttr("loginUid");
        String couponId=getPara("couponId");
        ReqResponse<Record> r=new ReqResponse();
        try {
            enhance(OrderService.class).buyCoupon(couponId, loginUid);
        }catch (BusinessException e){
            r.setCode(1);
            r.setMsg(e.getMessage());
        }
        renderJson(r);
    }*/




}
